/* 路由
 * @Author: wujie 
 * @Date: 2018-06-19 16:51:17 
 * @Last Modified by: wujie
 * @Last Modified time: 2018-07-19 14:02:10
 */
import React from 'react'
import { Router, Route, Switch  } from 'react-router-dom'
import containers from '@/containers'
import components from '@/components'
import { history } from './history'

const { 
  Layout,
  Main,
  Send, 
  BatchRecord, 
  SendRecord, 
  UpStreamRecord, 
  Sign, 
  SignEdit, 
  DayStatistics, 
  MonthStatistics,
  Template,
  TemplateEdit,
  WhiteList,
  Login,
  Register,
  IndividuationSetting,
  RechargeRecord,
} = containers

const { NotFound } = components

// 子路由设置
const Index = (props) => {
  // console.log('path => ',props)
  return (
    <Layout {...props} >
      <Switch>
        <Route path='/index' exact component={Main} /> 
        <Route path='/index/send' component={Send} /> 
        <Route path='/index/batchRecord' component={BatchRecord} />
        <Route path='/index/sendRecord' component={SendRecord} />
        <Route path='/index/upStreamRecord' component={UpStreamRecord} />
        <Route path='/index/sign' component={Sign} />
        <Route path='/index/signEdit' component={SignEdit} />
        <Route path='/index/template' component={Template} />
        <Route path='/index/templateEdit' component={TemplateEdit} />
        <Route path='/index/dayStatistics' component={DayStatistics} />
        <Route path='/index/monthStatistics' component={MonthStatistics} />
        <Route path='/index/whiteList' component={WhiteList} />
        <Route path='/index/individuationSetting' component={IndividuationSetting} />
        <Route path='/index/rechargeRecord' component={RechargeRecord} />
        <Route path='*' component={NotFound} />
      </Switch>
    </Layout>
  )
}

 const RootRouter = (props) => {
  return (
    <Router history={history}>
      <Switch>
        <Route path='/' exact component={Login} />
        <Route path='/index' component={Index} />
        <Route path='/register' component={Register} />
      </Switch>
    </Router>
  )
}

export default RootRouter